home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / expect / configure < prev    next >
Text File  |  1993-04-27  |  24KB  |  930 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
  23. # --with-PACKAGE unless this script has special code to handle it.
  24.  
  25.  
  26. for arg
  27. do
  28.   # Handle --exec-prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      # For backward compatibility, also recognize exact --exec_prefix.
  39.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  40.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  41.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  42.     next_exec_prefix=yes ;;
  43.  
  44.      -gas | --gas | --ga | --g) ;;
  45.  
  46.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  47.      -host | --host | --hos | --ho | --h)
  48.     next_host=yes ;;
  49.  
  50.      -nfp | --nfp | --nf) ;;
  51.  
  52.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  53.         no_create=1 ;;
  54.  
  55.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  56.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  58.     next_prefix=yes ;;
  59.  
  60.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  61.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  62.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  63.     next_srcdir=yes ;;
  64.  
  65.      -with-* | --with-*)
  66.        package=`echo $arg|sed 's/-*with-//'`
  67.        # Delete all the valid chars; see if any are left.
  68.        if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
  69.          echo "configure: $package: invalid package name" >&2; exit 1
  70.        fi
  71.        eval "with_`echo $package|sed s/-/_/g`=1" ;;
  72.  
  73.      *) ;;
  74.     esac
  75.   fi
  76. done
  77.  
  78. trap 'rm -f conftest* core; exit 1' 1 3 15
  79.  
  80. rm -f conftest*
  81. compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  82.  
  83. # A filename unique to this package, relative to the directory that
  84. # configure is in, which we can look for to find out if srcdir is correct.
  85. unique_file=exp_global.h
  86.  
  87. # Find the source files, if location was not specified.
  88. if test -z "$srcdir"; then
  89.   srcdirdefaulted=yes
  90.   # Try the directory containing this script, then `..'.
  91.   prog=$0
  92.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  93.   test "X$confdir" = "X$prog" && confdir=.
  94.   srcdir=$confdir
  95.   if test ! -r $srcdir/$unique_file; then
  96.     srcdir=..
  97.   fi
  98. fi
  99. if test ! -r $srcdir/$unique_file; then
  100.   if test x$srcdirdefaulted = xyes; then
  101.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  102.   else
  103.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  104.   fi
  105.   exit 1
  106. fi
  107. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  108. # But we can't avoid them for `..', to make subdirectories work.
  109. case $srcdir in
  110.   .|/*|~*) ;;
  111.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  112. esac
  113.  
  114.  
  115. # Make sure to not get the incompatible SysV /etc/install and
  116. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  117. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  118. # or the AFS install, which mishandles nonexistent args.  (Sigh.)
  119. if test -z "$INSTALL"; then
  120.   echo checking for install
  121.   saveifs="$IFS"; IFS="${IFS}:"
  122.   for dir in $PATH; do
  123.     test -z "$dir" && dir=.
  124.     case $dir in
  125.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
  126.     *)
  127.       if test -f $dir/install; then
  128.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  129.       : # AIX
  130.     else
  131.       INSTALL="$dir/install -c"
  132.       INSTALL_PROGRAM='$(INSTALL)'
  133.       INSTALL_DATA='$(INSTALL) -m 644'
  134.       break
  135.     fi
  136.       fi
  137.       ;;
  138.     esac
  139.   done
  140.   IFS="$saveifs"
  141. fi
  142. INSTALL=${INSTALL-cp}
  143. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  144. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  145.  
  146. if test -z "$RANLIB"; then
  147.   echo checking for ranlib
  148.   saveifs="$IFS"; IFS="${IFS}:"
  149.   for dir in $PATH; do
  150.     test -z "$dir" && dir=.
  151.     if test -f $dir/ranlib; then
  152.       RANLIB="ranlib"
  153.       break
  154.     fi
  155.   done
  156.   IFS="$saveifs"
  157. fi
  158. test -z "$RANLIB" && RANLIB="@:"
  159.  
  160.  
  161. echo checking for pid_t in sys/types.h
  162. echo checking how to run the C preprocessor
  163. if test -z "$CPP"; then
  164.   CPP='${CC-cc} -E'
  165.   cat > conftest.c <<EOF
  166. #include <stdio.h>
  167. EOF
  168. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  169. if test -z "$err"; then
  170.   :
  171. else
  172.   CPP=/lib/cpp
  173. fi
  174. rm -f conftest*
  175. fi
  176.  
  177. echo '#include <sys/types.h>' > conftest.c
  178. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  179. if egrep "pid_t" conftest.out >/dev/null 2>&1; then
  180.   :
  181. else 
  182.   DEFS="$DEFS -Dpid_t=int"
  183. SEDDEFS="${SEDDEFS}\${SEDdA}pid_t\${SEDdB}pid_t\${SEDdC}int\${SEDdD}
  184. \${SEDuA}pid_t\${SEDuB}pid_t\${SEDuC}int\${SEDuD}
  185. \${SEDeA}pid_t\${SEDeB}pid_t\${SEDeC}int\${SEDeD}
  186. "
  187. fi
  188. rm -f conftest*
  189.  
  190.  
  191. #
  192. # Look for various header files
  193. #
  194. echo checking for string.h
  195. cat > conftest.c <<EOF
  196. #include <string.h>
  197. EOF
  198. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  199. if test -z "$err"; then
  200.   :
  201. else
  202.   DEFS="$DEFS -DNO_STRING_H=1"
  203. SEDDEFS="${SEDDEFS}\${SEDdA}NO_STRING_H\${SEDdB}NO_STRING_H\${SEDdC}1\${SEDdD}
  204. \${SEDuA}NO_STRING_H\${SEDuB}NO_STRING_H\${SEDuC}1\${SEDuD}
  205. \${SEDeA}NO_STRING_H\${SEDeB}NO_STRING_H\${SEDeC}1\${SEDeD}
  206. "
  207. fi
  208. rm -f conftest*
  209.  
  210. echo checking for stdlib.h
  211. cat > conftest.c <<EOF
  212. #include <stdlib.h>
  213. EOF
  214. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  215. if test -z "$err"; then
  216.   :
  217. else
  218.   DEFS="$DEFS -DNOSTDLIB=1"
  219. SEDDEFS="${SEDDEFS}\${SEDdA}NOSTDLIB\${SEDdB}NOSTDLIB\${SEDdC}1\${SEDdD}
  220. \${SEDuA}NOSTDLIB\${SEDuB}NOSTDLIB\${SEDuC}1\${SEDuD}
  221. \${SEDeA}NOSTDLIB\${SEDeB}NOSTDLIB\${SEDeC}1\${SEDeD}
  222. "
  223. fi
  224. rm -f conftest*
  225.  
  226. echo checking for sys/stropts.h
  227. cat > conftest.c <<EOF
  228. #include <sys/stropts.h>
  229. EOF
  230. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  231. if test -z "$err"; then
  232.   DEFS="$DEFS -DHAVE_STROPTS_H=1"
  233. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_STROPTS_H\${SEDdB}HAVE_STROPTS_H\${SEDdC}1\${SEDdD}
  234. \${SEDuA}HAVE_STROPTS_H\${SEDuB}HAVE_STROPTS_H\${SEDuC}1\${SEDuD}
  235. \${SEDeA}HAVE_STROPTS_H\${SEDeB}HAVE_STROPTS_H\${SEDeC}1\${SEDeD}
  236. "
  237. fi
  238. rm -f conftest*
  239.  
  240. echo checking for sys/sysconfig.h
  241. cat > conftest.c <<EOF
  242. #include <sys/sysconfig.h>
  243. EOF
  244. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  245. if test -z "$err"; then
  246.   DEFS="$DEFS -DHAVE_SYSCONF_H=1"
  247. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYSCONF_H\${SEDdB}HAVE_SYSCONF_H\${SEDdC}1\${SEDdD}
  248. \${SEDuA}HAVE_SYSCONF_H\${SEDuB}HAVE_SYSCONF_H\${SEDuC}1\${SEDuD}
  249. \${SEDeA}HAVE_SYSCONF_H\${SEDeB}HAVE_SYSCONF_H\${SEDeC}1\${SEDeD}
  250. "
  251. fi
  252. rm -f conftest*
  253.  
  254. echo checking for sys/fcntl.h
  255. cat > conftest.c <<EOF
  256. #include <sys/fcntl.h>
  257. EOF
  258. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  259. if test -z "$err"; then
  260.   DEFS="$DEFS -DHAVE_SYS_FCNTL_H=1"
  261. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYS_FCNTL_H\${SEDdB}HAVE_SYS_FCNTL_H\${SEDdC}1\${SEDdD}
  262. \${SEDuA}HAVE_SYS_FCNTL_H\${SEDuB}HAVE_SYS_FCNTL_H\${SEDuC}1\${SEDuD}
  263. \${SEDeA}HAVE_SYS_FCNTL_H\${SEDeB}HAVE_SYS_FCNTL_H\${SEDeC}1\${SEDeD}
  264. "
  265. fi
  266. rm -f conftest*
  267.  
  268. echo checking for sys/sysmacros.h
  269. cat > conftest.c <<EOF
  270. #include <sys/sysmacros.h>
  271. EOF
  272. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  273. if test -z "$err"; then
  274.   DEFS="$DEFS -DHAVE_SYSMACROS_H=1"
  275. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYSMACROS_H\${SEDdB}HAVE_SYSMACROS_H\${SEDdC}1\${SEDdD}
  276. \${SEDuA}HAVE_SYSMACROS_H\${SEDuB}HAVE_SYSMACROS_H\${SEDuC}1\${SEDuD}
  277. \${SEDeA}HAVE_SYSMACROS_H\${SEDeB}HAVE_SYSMACROS_H\${SEDeC}1\${SEDeD}
  278. "
  279. fi
  280. rm -f conftest*
  281.  
  282. echo checking for unistd.h
  283. cat > conftest.c <<EOF
  284. #include <unistd.h>
  285. EOF
  286. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  287. if test -z "$err"; then
  288.   DEFS="$DEFS -DHAVE_UNISTD_H=1"
  289. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_UNISTD_H\${SEDdB}HAVE_UNISTD_H\${SEDdC}1\${SEDdD}
  290. \${SEDuA}HAVE_UNISTD_H\${SEDuB}HAVE_UNISTD_H\${SEDuC}1\${SEDuD}
  291. \${SEDeA}HAVE_UNISTD_H\${SEDeB}HAVE_UNISTD_H\${SEDeC}1\${SEDeD}
  292. "
  293. fi
  294. rm -f conftest*
  295.  
  296.  
  297. #
  298. # Look for various functions
  299. #
  300. echo checking for memcpy
  301. cat > conftest.c <<EOF
  302. #include <stdio.h>
  303. main() { exit(0); } 
  304. t() { 
  305. #ifdef __stub_memcpy
  306. choke me
  307. #else
  308. /* Override any gcc2 internal prototype to avoid an error.  */
  309. extern char memcpy(); memcpy();
  310. #endif
  311.  }
  312. EOF
  313. if eval $compile; then
  314.   :
  315. else
  316.   DEFS="$DEFS -DNO_MEMCPY=1"
  317. SEDDEFS="${SEDDEFS}\${SEDdA}NO_MEMCPY\${SEDdB}NO_MEMCPY\${SEDdC}1\${SEDdD}
  318. \${SEDuA}NO_MEMCPY\${SEDuB}NO_MEMCPY\${SEDuC}1\${SEDuD}
  319. \${SEDeA}NO_MEMCPY\${SEDeB}NO_MEMCPY\${SEDeC}1\${SEDeD}
  320. "
  321. fi
  322. rm -f conftest*
  323. #endif
  324.  
  325. echo checking for waitpid
  326. cat > conftest.c <<EOF
  327. #include <stdio.h>
  328. main() { exit(0); } 
  329. t() { 
  330. #ifdef __stub_waitpid
  331. choke me
  332. #else
  333. /* Override any gcc2 internal prototype to avoid an error.  */
  334. extern char waitpid(); waitpid();
  335. #endif
  336.  }
  337. EOF
  338. if eval $compile; then
  339.   :
  340. else
  341.   DEFS="$DEFS -DNOWAITPID=1"
  342. SEDDEFS="${SEDDEFS}\${SEDdA}NOWAITPID\${SEDdB}NOWAITPID\${SEDdC}1\${SEDdD}
  343. \${SEDuA}NOWAITPID\${SEDuB}NOWAITPID\${SEDuC}1\${SEDuD}
  344. \${SEDeA}NOWAITPID\${SEDeB}NOWAITPID\${SEDeC}1\${SEDeD}
  345. "
  346. fi
  347. rm -f conftest*
  348. #endif
  349.  
  350. echo checking for wait4
  351. cat > conftest.c <<EOF
  352. #include <stdio.h>
  353. main() { exit(0); } 
  354. t() { 
  355. #ifdef __stub_wait4
  356. choke me
  357. #else
  358. /* Override any gcc2 internal prototype to avoid an error.  */
  359. extern char wait4(); wait4();
  360. #endif
  361.  }
  362. EOF
  363. if eval $compile; then
  364.   :
  365. else
  366.   DEFS="$DEFS -DHAVE_WAIT4=1"
  367. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_WAIT4\${SEDdB}HAVE_WAIT4\${SEDdC}1\${SEDdD}
  368. \${SEDuA}HAVE_WAIT4\${SEDuB}HAVE_WAIT4\${SEDuC}1\${SEDuD}
  369. \${SEDeA}HAVE_WAIT4\${SEDeB}HAVE_WAIT4\${SEDeC}1\${SEDeD}
  370. "
  371. fi
  372. rm -f conftest*
  373. #endif
  374.  
  375. echo checking for sysconf
  376. cat > conftest.c <<EOF
  377. #include <stdio.h>
  378. main() { exit(0); } 
  379. t() { 
  380. #ifdef __stub_sysconf
  381. choke me
  382. #else
  383. /* Override any gcc2 internal prototype to avoid an error.  */
  384. extern char sysconf(); sysconf();
  385. #endif
  386.  }
  387. EOF
  388. if eval $compile; then
  389.   DEFS="$DEFS -DHAVE_SYSCONF=1"
  390. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYSCONF\${SEDdB}HAVE_SYSCONF\${SEDdC}1\${SEDdD}
  391. \${SEDuA}HAVE_SYSCONF\${SEDuB}HAVE_SYSCONF\${SEDuC}1\${SEDuD}
  392. \${SEDeA}HAVE_SYSCONF\${SEDeB}HAVE_SYSCONF\${SEDeC}1\${SEDeD}
  393. "
  394. fi
  395. rm -f conftest*
  396. #endif
  397.  
  398.  
  399. #
  400. # check how signals work
  401. #
  402.  
  403. # Check for the data type of the function used in signal(). This
  404. # must be before the test for rearming.
  405. echo checking return type of signal handlers
  406. echo '#include <signal.h>' > conftest.c
  407. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  408. if egrep "(void|sighandler_t).*signal" conftest.out >/dev/null 2>&1; then
  409.   retsigtype=void
  410. else 
  411.   DEFS="$DEFS -DRETSIGTYPE=int"
  412. SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}int\${SEDdD}
  413. \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}int\${SEDuD}
  414. \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}int\${SEDeD}
  415. " retsigtype=int
  416. fi
  417. rm -f conftest*
  418.  
  419.  
  420. # FIXME: check to see it alarm exists
  421. # Check to see it signals need to be re-armed after use.
  422. echo checking to see if signals need to be re-armed
  423. cat > conftest.c <<EOF
  424.  
  425. #include <signal.h>
  426. #define RETSIGTYPE $retsigtype
  427.  
  428. void
  429. sigquit_handler(n)
  430. int n;
  431. {
  432. }
  433.  
  434. main()
  435. {
  436.     if (0 == fork()) {
  437.         unlink("core");
  438.         signal(SIGQUIT,sigquit_handler);
  439.         kill(getpid(),SIGQUIT);
  440.         kill(getpid(),SIGQUIT);
  441.     } else {
  442.         int status;
  443.  
  444.         wait(&status);
  445.         exit(unlink("core")==-1?0:1);
  446.     }
  447. }
  448. EOF
  449. eval $compile
  450. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  451.   :
  452. else
  453.   DEFS="$DEFS -DREARM_SIG=1"
  454. SEDDEFS="${SEDDEFS}\${SEDdA}REARM_SIG\${SEDdB}REARM_SIG\${SEDdC}1\${SEDdD}
  455. \${SEDuA}REARM_SIG\${SEDuB}REARM_SIG\${SEDuC}1\${SEDuD}
  456. \${SEDeA}REARM_SIG\${SEDeB}REARM_SIG\${SEDeC}1\${SEDeD}
  457. "
  458. fi
  459. rm -f conftest*
  460.  
  461. # HPUX7 has trouble with the big cat so split it
  462. # Owen Rees <rtor@ansa.co.uk> 29Mar93 
  463. SEDDEFS="${SEDDEFS}CONFEOF
  464. cat >> conftest.sed <<CONFEOF
  465. "
  466. #
  467. # Look for various features to determine what kind of pty
  468. # we have. For some weird reason, ac_compile_check would not
  469. # work, but ac_test_program does.
  470. #
  471. echo checking for HP style pty allocation
  472. # following test fails on DECstations and other things that don't grok -c
  473. # but that's ok, since they don't have PTYMs anyway
  474. if test -c /dev/ptym/ptyp0 2>>/dev/null ; then
  475.     DEFS="$DEFS -DHAVE_PTYM=1"
  476. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PTYM\${SEDdB}HAVE_PTYM\${SEDdC}1\${SEDdD}
  477. \${SEDuA}HAVE_PTYM\${SEDuB}HAVE_PTYM\${SEDuC}1\${SEDuD}
  478. \${SEDeA}HAVE_PTYM\${SEDeB}HAVE_PTYM\${SEDeC}1\${SEDeD}
  479. "
  480. fi
  481.  
  482. echo checking for HP style pty-trapping
  483. echo '#include <sys/ptyio.h>' > conftest.c
  484. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  485. if egrep "struct.*request_info" conftest.out >/dev/null 2>&1; then
  486.   DEFS="$DEFS -DHAVE_PTYTRAP=1"
  487. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PTYTRAP\${SEDdB}HAVE_PTYTRAP\${SEDdC}1\${SEDdD}
  488. \${SEDuA}HAVE_PTYTRAP\${SEDuB}HAVE_PTYTRAP\${SEDuC}1\${SEDuD}
  489. \${SEDeA}HAVE_PTYTRAP\${SEDeB}HAVE_PTYTRAP\${SEDeC}1\${SEDeD}
  490. "
  491. fi
  492. rm -f conftest*
  493.  
  494.  
  495. echo checking for AIX new-style pty allocation
  496. if test -r /dev/ptc -a -r /dev/pts ; then
  497.     DEFS="$DEFS -DHAVE_PTC_PTS=1"
  498. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PTC_PTS\${SEDdB}HAVE_PTC_PTS\${SEDdC}1\${SEDdD}
  499. \${SEDuA}HAVE_PTC_PTS\${SEDuB}HAVE_PTC_PTS\${SEDuC}1\${SEDuD}
  500. \${SEDeA}HAVE_PTC_PTS\${SEDeB}HAVE_PTC_PTS\${SEDeC}1\${SEDeD}
  501. "
  502. fi
  503.  
  504. echo checking for SGI old-style pty allocation
  505. if test -r /dev/ptc -a ! -r /dev/pts ; then
  506.     DEFS="$DEFS -DHAVE_PTC=1"
  507. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PTC\${SEDdB}HAVE_PTC\${SEDdC}1\${SEDdD}
  508. \${SEDuA}HAVE_PTC\${SEDuB}HAVE_PTC\${SEDuC}1\${SEDuD}
  509. \${SEDeA}HAVE_PTC\${SEDeB}HAVE_PTC\${SEDeC}1\${SEDeD}
  510. "
  511. fi
  512.  
  513. echo checking for SVR4 style pty allocation
  514. if test -r /dev/ptmx ; then
  515.   DEFS="$DEFS -DHAVE_PTMX=1"
  516. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PTMX\${SEDdB}HAVE_PTMX\${SEDdC}1\${SEDdD}
  517. \${SEDuA}HAVE_PTMX\${SEDuB}HAVE_PTMX\${SEDuC}1\${SEDuD}
  518. \${SEDeA}HAVE_PTMX\${SEDeB}HAVE_PTMX\${SEDeC}1\${SEDeD}
  519. "
  520.   # aargg. Some systems need libpt.a to use /dev/ptmx
  521.     echo checking for libpt.a
  522.     echo checking for ptsname
  523.     cat > conftest.c <<EOF
  524. #include <stdio.h>
  525. main() { exit(0); } 
  526. t() { 
  527. #ifdef __stub_ptsname
  528. choke me
  529. #else
  530. /* Override any gcc2 internal prototype to avoid an error.  */
  531. extern char ptsname(); ptsname();
  532. #endif
  533.     }
  534. EOF
  535. if eval $compile; then
  536.   :
  537. else
  538.   LIBS=-lpt
  539. fi
  540. rm -f conftest*
  541. #endif
  542.  
  543. fi
  544.  
  545. echo checking for tcgetattr
  546. cat > conftest.c <<EOF
  547. #include <stdio.h>
  548. main() { exit(0); } 
  549. t() { 
  550. #ifdef __stub_tcgetattr
  551. choke me
  552. #else
  553. /* Override any gcc2 internal prototype to avoid an error.  */
  554. extern char tcgetattr(); tcgetattr();
  555. #endif
  556.  }
  557. EOF
  558. if eval $compile; then
  559.   tcgetattr=1
  560. fi
  561. rm -f conftest*
  562. #endif
  563.  
  564. echo checking for tcsetattr
  565. cat > conftest.c <<EOF
  566. #include <stdio.h>
  567. main() { exit(0); } 
  568. t() { 
  569. #ifdef __stub_tcsetattr
  570. choke me
  571. #else
  572. /* Override any gcc2 internal prototype to avoid an error.  */
  573. extern char tcsetattr(); tcsetattr();
  574. #endif
  575.  }
  576. EOF
  577. if eval $compile; then
  578.   tcsetattr=1
  579. fi
  580. rm -f conftest*
  581. #endif
  582.  
  583. if test $tcgetattr -a $tcsetattr ; then
  584.     DEFS="$DEFS -DPOSIX=1"
  585. SEDDEFS="${SEDDEFS}\${SEDdA}POSIX\${SEDdB}POSIX\${SEDdC}1\${SEDdD}
  586. \${SEDuA}POSIX\${SEDuB}POSIX\${SEDuC}1\${SEDuD}
  587. \${SEDeA}POSIX\${SEDeB}POSIX\${SEDeC}1\${SEDeD}
  588. "
  589. fi
  590.  
  591. # first check for the pure bsd
  592. echo checking for struct sgttyb
  593. cat > conftest.c <<EOF
  594. #include <sgtty.h>
  595. main()
  596. {
  597.   struct sgttyb tmp;
  598.   exit(0);
  599. }
  600. EOF
  601. eval $compile
  602. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  603.   DEFS="$DEFS -DHAVE_SGTTYB=1"
  604. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SGTTYB\${SEDdB}HAVE_SGTTYB\${SEDdC}1\${SEDdD}
  605. \${SEDuA}HAVE_SGTTYB\${SEDuB}HAVE_SGTTYB\${SEDuC}1\${SEDuD}
  606. \${SEDeA}HAVE_SGTTYB\${SEDeB}HAVE_SGTTYB\${SEDeC}1\${SEDeD}
  607. " PTY_TYPE=sgttyb
  608. fi
  609. rm -f conftest*
  610.  
  611. # next check for the older style ttys
  612. echo checking for struct termio
  613. cat > conftest.c <<EOF
  614. #include <termio.h>
  615. main()
  616. {
  617.   struct termio tmp;
  618.   exit(0);
  619. }
  620. EOF
  621. eval $compile
  622. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  623.   DEFS="$DEFS -DHAVE_TERMIO=1"
  624. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TERMIO\${SEDdB}HAVE_TERMIO\${SEDdC}1\${SEDdD}
  625. \${SEDuA}HAVE_TERMIO\${SEDuB}HAVE_TERMIO\${SEDuC}1\${SEDuD}
  626. \${SEDeA}HAVE_TERMIO\${SEDeB}HAVE_TERMIO\${SEDeC}1\${SEDeD}
  627. " PTY_TYPE=termio
  628. fi
  629. rm -f conftest*
  630.  
  631. # now check for the new style ttys (not yet posix)
  632. echo checking for struct termios
  633. cat > conftest.c <<EOF
  634. #include <termios.h>
  635. main()
  636. {
  637.   struct termios tmp;
  638.   exit(0);
  639. }
  640. EOF
  641. eval $compile
  642. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  643.   DEFS="$DEFS -DHAVE_TERMIOS=1"
  644. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TERMIOS\${SEDdB}HAVE_TERMIOS\${SEDdC}1\${SEDdD}
  645. \${SEDuA}HAVE_TERMIOS\${SEDuB}HAVE_TERMIOS\${SEDuC}1\${SEDuD}
  646. \${SEDeA}HAVE_TERMIOS\${SEDeB}HAVE_TERMIOS\${SEDeC}1\${SEDeD}
  647. " PTY_TYPE=termios
  648. fi
  649. rm -f conftest*
  650.  
  651. # finally check for Cray style ttys
  652. echo checking for Cray-style ptys
  653. SETUID="@:"
  654. cat > conftest.c <<EOF
  655.  
  656. main(){
  657. #ifdef CRAY
  658.         return 0;
  659. #else
  660.     return 1;
  661. #endif
  662. }
  663.  
  664. EOF
  665. eval $compile
  666. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  667.   PTY_TYPE=unicos SETUID="chmod u+s"
  668. fi
  669. rm -f conftest*
  670. #
  671. # Check for select and/or poll. If both exist, we prefer select.
  672. # if neither exists, define SIMPLE_EVENT.
  673. #
  674. select=0
  675. poll=0
  676. echo checking for select
  677. cat > conftest.c <<EOF
  678. #include <stdio.h>
  679. main() { exit(0); } 
  680. t() { 
  681. #ifdef __stub_select
  682. choke me
  683. #else
  684. /* Override any gcc2 internal prototype to avoid an error.  */
  685. extern char select(); select();
  686. #endif
  687.  }
  688. EOF
  689. if eval $compile; then
  690.   select=1
  691. fi
  692. rm -f conftest*
  693. #endif
  694.  
  695. echo checking for poll
  696. cat > conftest.c <<EOF
  697. #include <stdio.h>
  698. main() { exit(0); } 
  699. t() { 
  700. #ifdef __stub_poll
  701. choke me
  702. #else
  703. /* Override any gcc2 internal prototype to avoid an error.  */
  704. extern char poll(); poll();
  705. #endif
  706.  }
  707. EOF
  708. if eval $compile; then
  709.   poll=1
  710. fi
  711. rm -f conftest*
  712. #endif
  713.  
  714. if test $poll -a $select ; then
  715.   EVENT_TYPE=select
  716.   poll=0
  717. elif test $poll ; then
  718.   EVENT_TYPE=poll
  719. elif test $select ; then
  720.   EVENT_TYPE=select
  721. else
  722.   DEFS="$DEFS -DSIMPLE_EVENT=1"
  723. SEDDEFS="${SEDDEFS}\${SEDdA}SIMPLE_EVENT\${SEDdB}SIMPLE_EVENT\${SEDdC}1\${SEDdD}
  724. \${SEDuA}SIMPLE_EVENT\${SEDuB}SIMPLE_EVENT\${SEDuC}1\${SEDuD}
  725. \${SEDeA}SIMPLE_EVENT\${SEDeB}SIMPLE_EVENT\${SEDeC}1\${SEDeD}
  726. "
  727. fi
  728.  
  729. #
  730. for func in getpty
  731. do
  732. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  733. echo checking for ${func}
  734. cat > conftest.c <<EOF
  735. #include <stdio.h>
  736. main() { exit(0); } 
  737. t() { 
  738. #ifdef __stub_${func}
  739. choke me
  740. #else
  741. /* Override any gcc2 internal prototype to avoid an error.  */
  742. extern char ${func}(); ${func}();
  743. #endif
  744.  }
  745. EOF
  746. if eval $compile; then
  747.   DEFS="$DEFS -D${trfunc}=1"
  748. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  749. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  750. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  751. "
  752. fi
  753. rm -f conftest*
  754. #endif
  755. done
  756.  
  757. for func in _getpty
  758. do
  759. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  760. echo checking for ${func}
  761. cat > conftest.c <<EOF
  762. #include <stdio.h>
  763. main() { exit(0); } 
  764. t() { 
  765. #ifdef __stub_${func}
  766. choke me
  767. #else
  768. /* Override any gcc2 internal prototype to avoid an error.  */
  769. extern char ${func}(); ${func}();
  770. #endif
  771.  }
  772. EOF
  773. if eval $compile; then
  774.   DEFS="$DEFS -D${trfunc}=1"
  775. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  776. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  777. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  778. "
  779. fi
  780. rm -f conftest*
  781. #endif
  782. done
  783.  
  784.  
  785. # SETUID="@:"
  786.  
  787. #
  788. # Set up makefile substitutions
  789. #
  790.  
  791.  
  792.  
  793. if test -n "$prefix"; then
  794.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  795.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  796. fi
  797. if test -n "$exec_prefix"; then
  798.   prsub="$prsub
  799. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%\
  800. exec_prefix\\1=\\2$exec_prefix%"
  801. fi
  802.  
  803. trap 'rm -f config.status; exit 1' 1 3 15
  804. echo creating config.status
  805. rm -f config.status
  806. cat > config.status <<EOF
  807. #!/bin/sh
  808. # Generated automatically by configure.
  809. # Run this file to recreate the current configuration.
  810. # This directory was configured as follows,
  811. # on host `(hostname || uname -n) 2>/dev/null`:
  812. #
  813. # $0 $*
  814.  
  815. for arg
  816. do
  817.   case "\$arg" in
  818.   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  819.   exec /bin/sh $0 $* ;;
  820.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  821. esac
  822. done
  823.  
  824. trap 'rm -f Makefile exp_conf.h conftest*; exit 1' 1 3 15
  825. INSTALL='$INSTALL'
  826. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  827. INSTALL_DATA='$INSTALL_DATA'
  828. RANLIB='$RANLIB'
  829. CPP='$CPP'
  830. PTY_TYPE='$PTY_TYPE'
  831. EVENT_TYPE='$EVENT_TYPE'
  832. SETUID='$SETUID'
  833. LIBS='$LIBS'
  834. srcdir='$srcdir'
  835. prefix='$prefix'
  836. exec_prefix='$exec_prefix'
  837. prsub='$prsub'
  838. EOF
  839. cat >> config.status <<\EOF
  840.  
  841. top_srcdir=$srcdir
  842. for file in .. Makefile; do if [ "x$file" != "x.." ]; then
  843.   srcdir=$top_srcdir
  844.   # Remove last slash and all that follows it.  Not all systems have dirname.
  845.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  846.   if test "$dir" != "$file"; then
  847.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  848.     test ! -d $dir && mkdir $dir
  849.   fi
  850.   echo creating $file
  851.   rm -f $file
  852.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  853.   sed -e "
  854. $prsub
  855. s%@INSTALL@%$INSTALL%g
  856. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  857. s%@INSTALL_DATA@%$INSTALL_DATA%g
  858. s%@RANLIB@%$RANLIB%g
  859. s%@CPP@%$CPP%g
  860. s%@PTY_TYPE@%$PTY_TYPE%g
  861. s%@EVENT_TYPE@%$EVENT_TYPE%g
  862. s%@SETUID@%$SETUID%g
  863. s%@LIBS@%$LIBS%g
  864. s%@srcdir@%$srcdir%g
  865. s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
  866. fi; done
  867.  
  868. echo creating exp_conf.h
  869. # These sed commands are put into SEDDEFS when defining a macro.
  870. # They are broken into pieces to make the sed script easier to manage.
  871. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  872. # is the cpp macro being defined and VALUE is the value it is being given.
  873. # Each defining turns into a single global substitution command.
  874. #
  875. # SEDd sets the value in "#define NAME VALUE" lines.
  876. SEDdA='s@^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  877. SEDdB='\([     ][     ]*\)[^     ]*@\1#\2'
  878. SEDdC='\3'
  879. SEDdD='@g'
  880. # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  881. SEDuA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  882. SEDuB='\([     ]\)@\1#\2define\3'
  883. SEDuC=' '
  884. SEDuD='\4@g'
  885. # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  886. SEDeA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  887. SEDeB='$@\1#\2define\3'
  888. SEDeC=' '
  889. SEDeD='@g'
  890. rm -f conftest.sed
  891. cat > conftest.sed <<CONFEOF
  892. EOF
  893. # Turn off quoting long enough to insert the sed commands.
  894. cat >> config.status <<EOF
  895. $SEDDEFS
  896. EOF
  897. cat >> config.status <<\EOF
  898. CONFEOF
  899. rm -f conftest.h
  900. # Break up the sed commands because old seds have small limits.
  901. cp $top_srcdir/exp_conf.h.in conftest.h1
  902. while :
  903. do
  904.   lines=`grep -c . conftest.sed`
  905.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  906.   rm -f conftest.s1 conftest.s2 conftest.h2
  907.   sed 40q conftest.sed > conftest.s1 # Like head -40.
  908.   sed 1,40d conftest.sed > conftest.s2 # Like tail +41.
  909.   sed -f conftest.s1 < conftest.h1 > conftest.h2
  910.   rm -f conftest.s1 conftest.h1 conftest.sed
  911.   mv conftest.h2 conftest.h1
  912.   mv conftest.s2 conftest.sed
  913. done
  914. rm -f conftest.sed conftest.h
  915. echo "/* exp_conf.h.  Generated automatically by configure.  */" > conftest.h
  916. cat conftest.h1 >> conftest.h
  917. rm -f conftest.h1
  918. if cmp -s exp_conf.h conftest.h 2>/dev/null; then
  919.   # The file exists and we would not be changing it.
  920.   rm -f conftest.h
  921. else
  922.   rm -f exp_conf.h
  923.   mv conftest.h exp_conf.h
  924. fi
  925.  
  926. EOF
  927. chmod +x config.status
  928. test -n "$no_create" || ./config.status
  929.  
  930.